// 一个系列的柱图、折线图
function getOption(data) {
  console.log(data,'d')
  var val = data;
  var value = val / 100;
  var startAngle = 180;
  var endAngle = 0;
  var splitCount = 20; // 刻度数量
  var fontSize = 35;
  var pointerAngle = (startAngle - endAngle) * (1 - value) + endAngle;
  let option = {
    tooltip: {
      show: true, // 是否显示提示框，默认为true
      // trigger: "item", // 数据项图形触发
      // axisPointer: {
      //   // 指示样式
      //   type: "shadow",
      //   axis: "auto",
      // },
      // padding: 5,
      // textStyle: {
      //   // 提示框内容的样式
      //   color: "#fff",
      // },
      // formatter: function (params) {
      //   return (
      //     '<span style="color: #fff;">超标数'+ getvalue/100 * _that.sxt.sum + "个</span>"
      //   );
      // },
    },
    // polar: {
    //   center: ["50%", "50%"],
    //   radius: "170%", //图形大小
    // },
    series: [{ // 值外
        type: 'gauge',
        radius: '130%',
        center: ["50%", "70%"],
        startAngle: pointerAngle,
        endAngle: endAngle,
        splitNumber: 1,
        axisLine: {
          show: false,
          lineStyle: {
            width: 3,
            opacity: 0
          }
        },
        title: {
          show: false
        },
        detail: {
          color: '#343d3c',
          fontSize,
          offsetCenter: [0, -50],
          formatter: `${val}`
        },
        splitLine: {
          show: false
        },
        axisTick: {
          length: 10,
          splitNumber: Math.ceil((1 - value) * splitCount),
          lineStyle: {
            color: '#dbdbdb',
            width: 3
          }
        },
        axisLabel: {
          show: false
        },
        pointer: {
          show: false
        },
        itemStyle: {},
        markPoint: {
          animation: true,
          silent: false,
          data: [{
              symbolSize: 280,
              itemStyle: {
                borderWidth: 3,
              }
            },
            {
              symbol: 'circle',
              symbolSize: 200
            }
          ]
        },
        data: [{
          value: value,
          name: 'test gauge'
        }]
      },
      { // 值内
        type: 'gauge',
        radius: '130%',
        center: ["50%", "70%"],
        startAngle: startAngle,
        endAngle: pointerAngle,
        splitNumber: 1,
        axisLine: {
          show: false,
          lineStyle: {
            width: 3,
            opacity: 0
          }
        },
        tooltip: {
          show: true,
        },
        title: {
          show: false
        },
        detail: {
          show: false
        },
        splitLine: {
          show: false
        },
        axisTick: {
          length: 10,
          splitNumber: Math.ceil(value * splitCount),
          lineStyle: {

            color: "#458CDB",
            width: 3
          }
        },
        axisLabel: {
          show: false
        },
        pointer: {
          show: false
        },
        itemStyle: {},
        data: [{
          value: value,
          name: 'test gauge'
        }]
      }
    ]


  };
  return option;
}
module.exports = {
  //必须在这里暴露接口，以便被外界访问，不然就不能访问
  getOption: getOption,
};